// program:		replication.do
// task:		Replicate ANES data findings (correlations between racial resentment and climate opinions, predicted probabilities)
// project:		The spillover of race and racial attitudes into public opinion about climate change
// author:		Salil D. Benegal | 03.12.2018

gen Consresent= Conservative * resentment
gen Libresent= Liberal * resentment
gen Rresent = Rep * resentment
gen Dresent = Dem * resentment

// Warming is happening: model 1 

logit gwb resentment Rep Dem Conservative Liberal sex1 educ1 educ4 educ5 whiterace2 age, cluster(version)

// Warming is happening: model 2 w/ interaction

logit gwb resentment Rep Dem Rresent Dresent Conservative Liberal sex1 educ1 educ4 educ5 whiterace2 age, cluster(version)

prgen resent, from(1) to(5) x(Rep=1 Dem=0 whiterace2=1) rest(mean) gen(gRR1) gap(0.25) ci

label var gRR1p0 "P(Disagree w/ scientific consensus)"
label var gRR1p1 "P(Climate change occurring now)"
label var gRR1x "Racial resentment"

graph twoway (rarea gRR1p0ub gRR1p0lb gRR1x, color(gs12)) (rarea gRR1p1ub gRR1p1lb gRR1x, color(gs12)) ///
(connected gRR1p1 gRR1x, lpattern(dash) msize(zero)) (connected gRR1p0 gRR1x, lpattern(solid) msize(zero)), ///
ytitle("Predicted probability") title("Climate change occurring now") graphregion(color(white)) legend(order(3 4) rows(2)) name(ccb1)

// CC due to human activity: model 3

logit acc resentment Rep Dem Conservative Liberal sex1 educ1 educ4 educ5 whiterace2 age, cluster(version)

// CC due to human activity: model 4 w/ interaction

logit acc resentment Rep Dem Rresent Dresent Conservative Liberal sex1 educ1 educ4 educ5 whiterace2 age, cluster(version)

prgen resent, from(1) to(5) x(Rep=1 Dem=0 whiterace2=1) rest(mean) gen(gRR2) gap(0.25) ci

label var gRR2p0 "P(Disagree w/ scientific consensus)"
label var gRR2p1 "P(Climate change anthropogenic)"
label var gRR2x "Racial resentment"

graph twoway (rarea gRR2p0ub gRR2p0lb gRR2x, color(gs12)) (rarea gRR2p1ub gRR2p1lb gRR2x, color(gs12)) ///
(connected gRR2p1 gRR2x, lpattern(dash) msize(zero)) (connected gRR2p0 gRR2x, lpattern(solid) msize(zero)), ///
ytitle("Predicted probability") title("Climate change is anthropogenic") graphregion(color(white)) legend(order(3 4) rows(2)) name(acc1)

graph combine ccb1 acc1, title("Agreement with scientific consensus on climate change") ///
scheme(s1mono) cols(2)



